package org.tea.inventory.domain.sys;

import com.dgtis.dgt.SMSUtil;

import java.io.IOException;

/**
 * 多线程发送短信类
 */
public class MsgSMS implements Runnable {

    //短信目标人
    private String phones;
    //短信内容
    private String msg;


    public MsgSMS(String phones, String msg) {
        this.phones = phones;
        this.msg = msg;
    }

    /**
     * When an object implementing interface <code>Runnable</code> is used
     * to create a thread, starting the thread causes the object's
     * <code>run</code> method to be called in that separately executing
     * thread.
     * <p>
     * The general contract of the method <code>run</code> is that it may
     * take any action whatsoever.
     *
     * @see Thread#run()
     */
    @Override
    public void run() {
        try {
//            DhrmEmployeeInfoService dhrmEmployeeInfoService = new DhrmEmployeeInfoService();
//            DhrmEmployeeInfo empInfo = dhrmEmployeeInfoService.selectUserByStaffPhone(phones);
//            if(empInfo != null && !"20".equals(empInfo.getStaffStatus())){
            SMSUtil.sendSms(phones, msg);
//            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
